﻿<Window x:Class="ReportingManagement.Components.Queries.QueryResults"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" Width="640" Height="480"
             d:DesignHeight="360" d:DesignWidth="540" WindowStartupLocation="CenterOwner" WindowStyle="ToolWindow">

    <Grid Margin="3">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <DockPanel Margin="3">
            <Label Content="Report Name" />
            <ComboBox x:Name="cboReport" DisplayMemberPath="Name" VerticalContentAlignment="Center" />
        </DockPanel>
        <TextBlock Margin="3" Grid.Row="1" Padding="5,0,0,5" TextWrapping="Wrap" Text="{Binding SelectedItem.Description, ElementName=cboReport}" FontStyle="Italic" />
        <StackPanel Orientation="Horizontal" Grid.Row="2">
            <Button x:Name="btnRun" Content="Run" Margin="3" Padding="15,3" Click="btnRun_Click" IsDefault="True"/>
            <Button x:Name="btnExportToExcel" Content="Export to Excel" Margin="3" Padding="15,3" IsEnabled="False" Click="btnExportToExcel_Click" />
            <Button x:Name="btnTransformToChart" Content="Transform to Chart" Margin="3" Padding="15,3" IsEnabled="False" />
        </StackPanel>

        <DataGrid x:Name="dataGridResults" Grid.Row="3" Margin="3" CanUserAddRows="False" CanUserDeleteRows="False" 
                      IsReadOnly="True" AlternationCount="2" AlternatingRowBackground="WhiteSmoke" />

        <Grid x:Name="dataGridQueryStatus" Grid.Row="4" Margin="3,3,3,0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>

            <TextBlock Text="{Binding ExecutionStatus}" Foreground="{Binding TextColor, Mode=TwoWay}" TextTrimming="CharacterEllipsis" />
            <TextBlock Text="{Binding TimeTaken}" Grid.Column="2" TextTrimming="CharacterEllipsis" Margin="0,0,10,0" />
            <TextBlock Text="{Binding RowsReturned}" Grid.Column="3" TextTrimming="CharacterEllipsis" />
        </Grid>
    </Grid>
</Window>
